﻿@model IEnumerable<ISSMoviePlex.DAL.Models.Schedule>

@{
    ViewBag.Title = "ShowSchedule";
}

<h2>ShowSchedule</h2>
<br />
@if (ViewBag.Error != string.Empty)
{
    <span style="color:Red;">@ViewBag.Error</span>
}
<br />
<br />
<table>
    <tr>
        <th>
            Movie
        </th>
        <th>
            Room
        </th>
        <th>
            Show Time
        </th>
        <th>
            Ticket Price
        </th>
        <th>
            Number Of Seat Available
        </th>
        <th>
            Number Of Ticket
        </th>
        <th></th>
    </tr>

@foreach (var item in Model)
{
    <tr>
        <td style="text-align: center;">
            @Html.DisplayFor(modelItem => item.Movie.MovieName)
        </td>
        <td style="text-align: center;">
            @Html.DisplayFor(modelItem => item.RoomId)
        </td>
        <td style="text-align: center;">
            @Html.DisplayFor(modelItem => item.ShowTime)
        </td>
        <td style="text-align: center;">
            $@Html.DisplayFor(modelItem => item.TicketPrice)
        </td>
        <td style="text-align: center;">
            @Html.DisplayFor(modelItem => item.SeatAvailable)
        </td>

        @using (Html.BeginForm(new { movieId = item.MovieId, scheduleId = item.ScheduleId }))
        {
        <td style="text-align: center;">
            @Html.TextBox("numberOfTicket")
        </td>
        <td style="text-align: center;">
            <input type="submit" value="Buy" />
        </td>
        }
    </tr>
}

</table>
